package vy.org.app.page.ashram;

import org.vy.dal.dao.VyAshramDO;

import vy.org.util.DateUtil;

public class AshramDOAssembler {

	private static AshramDOAssembler ashramDOAssembler = new AshramDOAssembler();

	public static AshramDOAssembler getAssembler() {
		return ashramDOAssembler;
	}

	public VyAshramDO createAshramDO(MntnAshramForm form) {
		VyAshramDO dto = new VyAshramDO();

		if (form.getAshramcode() != null
				&& !"".equals(form.getAshramcode().trim())) {
			dto.setAshramcode(form.getAshramcode());
		}
		if (form.getAshramName() != null
				&& !"".equals(form.getAshramName().trim())) {
			dto.setAshramName(form.getAshramName());
		}
		if (form.getAshramAddress() != null
				&& !"".equals(form.getAshramAddress().trim())) {
			dto.setAshramAddress(Integer.parseInt(form.getAshramAddress()));
		}
		if (form.getAshramContactNo() != null
				&& !"".equals(form.getAshramContactNo().trim())) {
			dto.setAshramContactNo(form.getAshramContactNo());
		}
		if (form.getEmail() != null && !"".equals(form.getEmail().trim())) {
			dto.setEmail(form.getEmail());
		}
		if (form.getPrimaryContact() != null
				&& !"".equals(form.getPrimaryContact().trim())) {
			dto.setPrimarycontact(form.getPrimaryContact());
		}
		if (form.getSecondaryContact() != null
				&& !"".equals(form.getSecondaryContact().trim())) {
			dto.setSecondarycontact(form.getSecondaryContact());
		}
		if (form.getFax() != null && !"".equals(form.getFax().trim())) {
			dto.setFax(form.getFax());
		}
		if (form.getStartDate() != null
				&& !"".equals(form.getStartDate().trim())) {
			dto.setStartDate(DateUtil.standardDate(form.getStartDate()));
		}
		if (form.getOwnOrRent() != null
				&& !"".equals(form.getOwnOrRent().trim())) {
			dto.setOwnOrRent(form.getOwnOrRent());
		}
		if (form.getIsDeleted() != null
				&& !"".equals(form.getIsDeleted().trim())) {
			dto.setIsDeleted(form.getIsDeleted());
		}
		if (form.getComment() != null && !"".equals(form.getComment().trim())) {
			dto.setComment(form.getComment());
		}
		if (form.getLastUpdatedBy() != null
				&& !"".equals(form.getLastUpdatedBy().trim())) {
			dto.setLastUpdatedBy(form.getLastUpdatedBy());
		}
		if (form.getLastUpdatedOn() != null
				&& !"".equals(form.getLastUpdatedOn().trim())) {
			dto
					.setLastUpdatedOn(DateUtil.standardDate(form
							.getLastUpdatedOn()));
		}

		return dto;

	}
}
